import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

/**
 * 
 * @author Escalade
 */
public class View extends JPanel {

	public JButton okButton = null;
	public JButton cancelButton = null;

	public JList list = null;

	private MVC mvc = null;

	public View(MVC mvc) {
		super();
		setLayout(new BorderLayout());
		this.mvc = mvc;

		okButton = new JButton("OK");
		cancelButton = new JButton("CANCEL");

		list = new JList(mvc.getModel().listModel);
		list.setFixedCellHeight(20);
		list.addListSelectionListener(mvc.getController());
		JScrollPane listScrollPane = new JScrollPane(list);

		okButton.addActionListener(mvc.getController());
		cancelButton.addActionListener(mvc.getController());

		add(okButton, BorderLayout.NORTH);
		add(cancelButton, BorderLayout.SOUTH);
		add(listScrollPane, BorderLayout.CENTER);
	}
}